package view.plugin
{
	//退出比赛提示
	
	import flash.display.MovieClip;
	import flash.display.SimpleButton;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	
	import flash3.framework.Singleton;
	
	import global.Resource;
	
	import model.MeInfoModel;
	
	public class ExitPanel extends PanelBase
	{
		public var btnOK:SimpleButton = null;
		public var btnCansel:SimpleButton = null;
		private var tips:TextField = null;
		public static const OK:String = "ok";
		public static const CANSEL:String = "cansel";
		
		public function ExitPanel()
		{
			super();
			var main:MovieClip = Resource.i.getMovieClip("dlgExit", "DlgExit");
			addChild(main);
			btnOK = main.btnOK;
			btnCansel = main.btnCansel;
			btnOK.addEventListener(MouseEvent.CLICK, onClickBtnOK);
			btnCansel.addEventListener(MouseEvent.CLICK, onClickBtnCansel);
			tips = main.tips;
		}
		public function set text(t:String):void
		{
			tips.text = t;
		}
		private function onClickBtnOK(evt:MouseEvent):void
		{
			show(false);
			this.dispatchEvent(new Event(OK));
		}
		
		private function onClickBtnCansel(evt:MouseEvent):void
		{
			this.dispatchEvent(new Event(CANSEL));
		}
		static public function getStr1():String
		{
			return "您现有汽油"+MeInfoModel.i.userScore.lScore+"桶，可兑回金币"+MeInfoModel.i.userScore.lMoneyGold+"个.";
		}
		static public function getStr2():String
		{
			return "当前游戏尚未结束，游戏中离开会被加倍罚分。";
		}
		
		static public function get i():ExitPanel
		{
			return Singleton.getInstanceOrCreate(ExitPanel) as ExitPanel;
		}
	}
}